/*
 * @Author: qin
 * @Date:   2018-08-28
 * +----------------------------------------------------------------------
 * | admin [ 后台管理系统公共配置信息 ]
 * | 机构列表公共页
 * +----------------------------------------------------------------------
 */
layui.define(['jquery', 'bluebird', 'element', 'table', 'selectFun', 'form', 'configure', 'configureCom'], function (exports) {
    var $ = layui.$;
    var element = layui.element;
    var form = layui.form;
    var configure = layui.configure;
    var configureCom = layui.configureCom;
    var selectFun = layui.selectFun;
    var table = layui.table;
    var type = configureCom.GetQueryString('type');
    var typeItem = configureCom.GetQueryString('typeItem');
    var url = configure.ORGAN_LIST_SEARCH_HTTP;
    var organList = {
        parentComponent: null,//父组件实例
        data: {
            selectOrganId: 0,//当前选中的机构ID,
            selectOrganName: '',//当前选中的机构名字,
            searchData: {
                type: type,//机构类型[建设单位:1010、审查机构:1020、勘察单位:1030、设计单位1040、监管机构：1050]
                typeItem: typeItem//机构子类型[住建:1010、消防:1020、人防:1030,建设单位有营业执照:2010、建设单位无营业执照:2020、建设单位个人:2030]
            }
        },
        render: function () {
            var cols = [[ //表头
                {
                    title: '组织机构代码', field: 'code'
                },
                {
                    title: '企业名称', field: 'name'
                }
            ]];
            configureCom.tableRender(url, organList.data.searchData, cols);
        },
        eventBind: function () {
            //项目 操作
            table.on('rowDouble(klmyTable)', function (obj) {// 双击选中
                organList.data.selectOrganId = obj.data.id;
                organList.data.selectOrganName = obj.data.name;
                window.parWin.saveForm(organList.data);
            });
            //监听搜索
            configureCom.tableSearch();
        }
    };

    exports('organList', organList);
});


